// pages/detail/store_list.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    local:[
      { latitude:24.487932, longitude:118.181062,name:'厦门美家帮科技股份有限公司',address:'厦门市湖里区吕岭路10号',tele:'4006059201',distance:2},
      { latitude: 24.531033, longitude: 118.167764, name: '厦门九鼎建筑设计', address: '厦门市湖里区安岭二路86好', tele: '18559697088',distance:3},
      { latitude: 24.515831, longitude: 118.165619, name: '厦门宝发佳宜装饰有限公司', address: '厦门穆厝', tele: '18120725179', distance: 5},
      { latitude: 24.498222, longitude: 118.140319, name: '厦门立邦装饰有限公司', address: '吕岭路长安大厦12E', tele: '0592-5566811', distance: 7},
      { latitude: 24.535446, longitude: 118.170702, name: '厦门威尔思装饰工程有限公司', address: '银鹭集团大厦二楼', tele: '15160099311', distance: 4.6},
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      var local = this.data.local
      this.setData({
        polist: local
      })
  },
  //导航去具体店里
  getmapnav:function(e){
    var name = e.currentTarget.dataset.name
    var lau = e.currentTarget.dataset.latu  
    console.log(lau)
    var lou = e.currentTarget.dataset.lotu
    var address = e.currentTarget.dataset.address
    wx.getLocation({//获取当前经纬度
      type: 'wgs84', //返回可以用于wx.openLocation的经纬度，官方提示bug: iOS 6.3.30 type 参数不生效，只会返回 wgs84 类型的坐标信息  
      success: function (res) {
        wx.openLocation({//​使用微信内置地图查看位置。
          latitude: lau,//要去的纬度-地址
          longitude: lou,//要去的经度-地址
          name: name,
          address: address
        })
      }
    })
  },
  //打电话
  gettelephone:function(e){
      var tele = this.data.telepho
      var tele= e.currentTarget.dataset.tele 
      wx.makePhoneCall({
        phoneNumber: tele
      })
  }

})